Skip to content

Conversation

@Averydx
Copy link

@Averydx Averydx commented Jan 8, 2026

This ADRIO is designed to draw from two columns in the dataset COVID-19 Reported Patient Impact and Hospital Capacity by State Timeseries (RAW) at https://healthdata.gov/Hospital/COVID-19-Reported-Patient-Impact-and-Hospital-Capa/g62h-syeh/about_data

The dataset does not appear to have any missing values, but I retained the missing value checks just in case. Example setup of the ADRIO would look like

cdcadrio_H = cdc.InfluenzaStateHospitalizationDaily( fix_missing=0, column = 'hospitalizations' ).with_context( time_frame=TimeFrame.of("2022-09-15", 7 * 26 + 1), scope=StateScope.in_states(["AZ","NV"], year=2019), )

where column can be the string hospitalizations or admissions.

Copy link
Contributor

@JavadocMD JavadocMD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See inline comments for changes. Also (if you haven't already) make sure to test that this ADRIO can successfully pull the entire dataset. We want to uncover any surprise data parsing issues.

self,
*,
fix_missing: FillLikeInt = False,
column: str
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there are only two valid values, this should be annotated more narrowly than string. i.e., column: Literal["admissions", "hospitalizations"]

self._fix_missing = Fill.of_int64(fix_missing)
except ValueError:
raise ValueError("Invalid value for `fix_missing`")
if not ((column == "admissions") or (column == "hospitalizations")):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When checking that a variable (especially a string) is in the set of valid values, prefer: column not in ("admissions", "hospitalizations"). It's not much shorter when there are only two valid values, but still there's less room for error (like someone does a copy-paste and changes column to another variable only the first clause).

order_by=(
q.Ascending("date"),
q.Ascending("state"),
q.Ascending(":id"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an FYI: including a sort by row ID is important because with SODA APIs, assembling complete results can require multiple requests (pagination; there's a limit to how many rows can be returned in one request). Thus we need to guarantee that the answer to "what's on page X?" is consistent between requests. Having an unambiguous sort order does that. It's possible date/state are sufficient for this dataset, but including ID makes it very certain and doesn't cost much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants